﻿#include "FuncDefine.h"
#include "design/CustomMessageDialog.h"
#include <QDebug>
CustomMessageDialog *g_pMessageDialog = nullptr;

bool showWarningMessage(const QString &strTitle, const QString &strInfo, const bool bNeedRet)
{
    if(nullptr == g_pMessageDialog)
    {
        g_pMessageDialog = new CustomMessageDialog(nullptr, PROC_TYPE_MSGSHOW);
    }

    g_pMessageDialog->setShowRetNeed(bNeedRet);
    g_pMessageDialog->setMessage(strTitle, strInfo, true);
    g_pMessageDialog->exec();

    return (PROC_STATUS_ACCEPT == g_pMessageDialog->getStatus() ? true : false);
}

bool showSucceeMessage(const QString& strTitle, const QString& strInfo, const bool bNeedRet)
{
    if(nullptr == g_pMessageDialog)
    {
        g_pMessageDialog = new CustomMessageDialog(nullptr, PROC_TYPE_MSGSHOW);
    }

    g_pMessageDialog->setShowRetNeed(bNeedRet);
    g_pMessageDialog->setMessage(strTitle, strInfo, false);
    g_pMessageDialog->exec();

    return (PROC_STATUS_ACCEPT == g_pMessageDialog->getStatus() ? true : false);
}
